package com.example.mobile2030606162zwh0330;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {

    private EditText edtTxtMainAccount;
    private EditText edtTxtMainPsw;
    private Button binmaindiv;
    private Button btnMainReset;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        binmaindiv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                String account= edtTxtMainAccount.getText().toString();
                String password=edtTxtMainPsw.getText().toString();



                if (account.length()==0){
                    Log.i("登录","请输入用户名");
                }else if (password.length()==0){
                    Log.i("登录","请输入密码");
                }else{

                }
                if (account.equals("admin")&password.equals("123456")){
                    Log.i("登录", "登录成功");
                }else{
                    Log.i("登录", "登录失败");
                }
                edtTxtMainAccount.setText(null);
                edtTxtMainPsw.setText(null);




            }
        });
    }

    @SuppressLint("WrongViewCast")
    private void initView() {
        edtTxtMainAccount=(EditText)findViewById(R.id.edtTxt_main_account);
        edtTxtMainPsw=(EditText)findViewById(R.id.edtTxt_main_psw);
        binmaindiv=(Button)findViewById(R.id.bin_main_div);
        btnMainReset=(Button)findViewById(R.id.btn_main_zhi);




        }
    }
